#ifndef KRAUTCHANAGENT_H
#define KRAUTCHANAGENT_H

#include <QtPlugin>
#include "chanagents/defaultagent.h"

namespace Wishmaster
{
	class KrautchanAgent : public DefaultAgent
	{
		Q_OBJECT
		Q_INTERFACES(Wishmaster::ChanAgent)
	public:
		KrautchanAgent(const QString& host = QString());
		virtual ~KrautchanAgent();

		virtual void getCaptcha(const ThreadId& threadId);
		virtual void makePost(const PostDescriptor& post, const QString& captcha);
		virtual void createThread(const PostDescriptor& post, const QString& captcha);

		virtual void deleteThread(const ThreadId& threadId, const QString& password);
		virtual void deletePost(const PostId& postId, const QString& password);
		virtual QStringList ratings();

		virtual ChanAgent* clone(const QString& host);
		virtual QString id();

	protected slots:
		void resultPost(const HttpRequestPtr& r, const QByteArray& data);

	private:
		QString defaultedString(const QString& str, const QString& def);

		QString m_host;
	};
}

#endif // KRAUTCHANAGENT_H
